package com.wl.dzt.basic.controller;

import com.wl.dzt.basic.service.BasicOrganizationService;
import com.wl.dzt.sys.util.WebUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @author wl_code@163.com
 * @version 1.0
 * @date 2018/7/12/012
 * @description 企业域管理
 */
@Api(description = "admin/basicOrganization", tags = "企业域管理(basic-api)")
@Controller
@RequestMapping("admin/basicOrganization")
public class BasicOrganizationController {


    @Resource
    private BasicOrganizationService basicOrganizationService;

    /**
     * <b>改变企业域状态</b>
     * <p>
     * 根据传递状态改变企业域状态
     * </p>
     *
     * @param response
     * @param id
     * @param state
     */
    @ApiOperation("修改企业域状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "组织机构编号", dataType = "String", paramType = "body", required = true),
            @ApiImplicitParam(name = "state", value = "是否启用企业域状态(0停封,1启用)", dataType = "String", paramType = "body", required = true, defaultValue = "1")
    })
    @PostMapping("changeAreaState")
    public void changeAreaState(HttpServletResponse response, String id, String state) {
        WebUtils.print(basicOrganizationService.changeAreaState(id, state) + "", response);
    }

}
